home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 1.6 KB | 56 lines |
- /*
- * QuickTime for Java SDK Sample Code
-
- Usage subject to restrictions in SDK License Agreement
- * Copyright: © 1996-1999 Apple Computer, Inc.
-
- */
- package mixer;
-
- import java.awt.*;
- import javax.swing.*;
-
- import quicktime.*;
- import quicktime.app.audio.*;
-
- /** This is the main display for the Mixer program. This is how we present all of
- * our mixer tools.
- */
- public class MixerDialog extends JDialog implements SwingConstants {
- /** The frame that owns this dialog box. */
- public static Frame parentFrame;
-
- /** The default name that will show in the dialog's title area. */
- public static String defaultName;
-
- /** The constructor takes any component you create to represent the mixer, and
- * displays it in a dialog box.
- * @param mixer the JComponent that contains your mixer controls.
- */
- public MixerDialog (JComponent mixer) throws QTException {
- super (parentFrame, defaultName, false);
-
- Container cp = getContentPane();
- cp.setLayout(new GridBagLayout());
- GridBagConstraints cons = new GridBagConstraints();
- cons.gridx = 0;
- cons.gridy = 0;
- cons.weightx = 0.0F;
- cons.weighty = 0.0F;
- cons.fill = GridBagConstraints.NONE;
- cons.anchor = GridBagConstraints.CENTER;
- cp.add (mixer, cons);
- pack();
-
- // The next two lines are very specific to our code. Swing wasn't making a default
- // size quite big enough, so we just set a lower limit.
- Dimension d = mixer.getPreferredSize();
- mixer.setPreferredSize(new Dimension(d.width, d.height < 300 ? 300 : d.height));
-
- Rectangle loc = parentFrame.getBounds();
- setLocation(loc.x, loc.height + loc.y);
- pack();
- show();
- }
- }
-